/* 时间轴容器 */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    background-color: var(--bg-color);
}

/* 时间轴头部 */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-title {
    flex: 1;
}

.timeline-title h1 {
    margin: 0;
    font-size: 24px;
    color: var(--text-color);
}

.timeline-title .subtitle {
    margin: 5px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 筛选器 */
.timeline-filters {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.timeline-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--button-bg);
    border-radius: 24px;
}

.timeline-tabs .tab {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-tabs .tab i {
    font-size: 14px;
}

.timeline-tabs .tab:hover {
    color: var(--primary-color);
    background: var(--hover-bg);
}

.timeline-tabs .tab.active {
    background: var(--primary-200);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.date-filters {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--button-bg);
    border-radius: 24px;
}

.date-filter {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-filter i {
    font-size: 14px;
}

.date-filter:hover {
    color: var(--primary-color);
    background: var(--hover-bg);
}

.date-filter.active {
    background: var(--primary-200);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 统计面板 */
.timeline-stats {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.time-line-stats-card {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.time-line-stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.time-line-stats-card .stats-title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-line-stats-card .stats-title i {
    color: var(--primary-color);
}

.stats-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

/* 时间轴内容 */
.timeline-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 时间轴内容的新样式 */
.timeline-date-group {
    position: relative;
    margin-bottom: 40px;
}

.timeline-date-header {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.timeline-date-header i {
    color: var(--primary-color);
}

.timeline-date-header .item-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    background: var(--tag-bg);
    padding: 2px 8px;
    border-radius: 12px;
}

.timeline-items {
    position: relative;
    padding-left: 20px;
}

/* 时间轴线条样式 */
.timeline-time-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    flex-shrink: 0;
}

.timeline-time {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0px;
    background: var(--bg-color);
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 1;
}

.timeline-line {
    position: relative;
    flex-grow: 1;
    width: 2px;
    background-color: var(--border-color);
    margin: 0 auto;
}

.timeline-line.first::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.timeline-line.last::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--border-color);
}

.timeline-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    z-index: 1;
}

/* 修改时间轴项目样式 */
.timeline-item {
    position: relative;
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    margin: 8px 0;
}

.timeline-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 不同类型项目的边框颜色 */
.timeline-item.task-item {
    border-left-color: #4CAF50;
}

.timeline-item.pomodoro-item {
    border-left-color: #F18F01;
}

.timeline-item.countdown-item {
    border-left-color: #3498db;
}

/* 状态样式 */
.timeline-item.completed {
    background: var(--bg-200);
    opacity: 0.8;
}

.timeline-item.in-progress {
    background: var(--bg-200);
    border: 1px solid var(--primary-color);
}

.timeline-item.ended {
    background: var(--bg-200);
    opacity: 0.7;
}

.timeline-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 18px;
}

.timeline-item-content {
    flex: 1;
    min-width: 0;
}

.timeline-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.timeline-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-item-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.timeline-item-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.timeline-item-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
}

.timeline-item-tag i {
    font-size: 14px;
}

.timeline-item-duration,
.timeline-item-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-item-actions {
    display: flex;
    gap: 8px;
}

.btn-notes {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.btn-notes:hover {
    background: var(--primary-200);
    color: white;
}

.notes-edit-content {
    width: 90%;
    max-width: 600px;
    padding: 20px;
    background: var(--bg-200);
    border-radius: 12px;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* 自适应调整位移 */
}

.notes-edit-content .modal-header {
    margin-bottom: 16px;
}

.notes-edit-content .modal-body {
    margin-bottom: 16px;
}

.notes-edit-content textarea {
    width: 100%;
    border: 1px solid var(--bg-300);
    background: var(--bg-200);
    border-radius: 4px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
}

.notes-edit-content .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.timeline-item-notes {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-100);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-color);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.timeline-item-notes i {
    color: var(--text-muted);
    margin-top: 4px;
}

.timeline-item-notes span {
    flex: 1;
    line-height: 1.5;
    white-space: pre-wrap;
}

.timeline-item-type {
    margin-left: auto;
}

/* 空状态样式 */
.timeline-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.timeline-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border-color);
}

.timeline-empty p {
    margin: 0;
    font-size: 16px;
}

.timeline-empty .empty-subtitle {
    font-size: 14px;
    margin-top: 8px;
    color: var(--text-secondary);
}

/* 搜索框 */
.timeline-search {
    padding: 0 20px;
    margin-bottom: 20px;
}

.timeline-search input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
}

.timeline-search input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .timeline-header {
        flex-direction: column;
        gap: 15px;
    }

    .timeline-filters {
        flex-direction: column;
        width: 100%;
    }

    .timeline-tabs,
    .date-filters {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
    .timeline-container {
        --bg-color: #1a1a1a;
        --card-bg: #2a2a2a;
        --text-color: #ffffff;
        --text-secondary: #a0a0a0;
        --border-color: #404040;
        --button-bg: #333333;
        --hover-bg: #404040;
        --progress-bg: #333333;
        --tag-bg: #333333;
        --input-bg: #333333;
    }

    .timeline-line {
        background-color: var(--border-color);
    }

    .timeline-dot {
        border-color: var(--card-bg);
    }

    .timeline-date-header {
        background: var(--card-bg);
    }

    .timeline-tabs,
    .date-filters {
        background: var(--card-bg);
    }

    .timeline-tabs .tab:hover,
    .date-filter:hover {
        background: var(--hover-bg);
    }

    .time-line-stats-card {
        background: var(--card-bg);
    }
}

/* 亮色主题 */
@media (prefers-color-scheme: light) {
    .timeline-container {
        --bg-color: #f5f5f5;
        --card-bg: #ffffff;
        --text-color: #333333;
        --text-secondary: #666666;
        --border-color: #e0e0e0;
        --button-bg: #f0f0f0;
        --hover-bg: #e8e8e8;
        --progress-bg: #f0f0f0;
        --tag-bg: #f0f0f0;
        --input-bg: #ffffff;
    }
}